//
// CZone.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CZone {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CZone(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CZone obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CZone(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CZone() {
    this(nel3dJNI.new_CZone(), true);
  }

  public void build(CZoneInfo zoneInfo, long numVertices) {
    nel3dJNI.CZone_build__SWIG_0(swigCPtr, this, CZoneInfo.getCPtr(zoneInfo), zoneInfo, numVertices);
  }

  public void build(CZoneInfo zoneInfo) {
    nel3dJNI.CZone_build__SWIG_1(swigCPtr, this, CZoneInfo.getCPtr(zoneInfo), zoneInfo);
  }

  public void build(long zoneId, SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t patchs, SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t borderVertices, long numVertices) {
    nel3dJNI.CZone_build__SWIG_2(swigCPtr, this, zoneId, SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t.getCPtr(patchs), SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t.getCPtr(borderVertices), numVertices);
  }

  public void build(long zoneId, SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t patchs, SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t borderVertices) {
    nel3dJNI.CZone_build__SWIG_3(swigCPtr, this, zoneId, SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t.getCPtr(patchs), SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t.getCPtr(borderVertices));
  }

  public void build(CZone zone) {
    nel3dJNI.CZone_build__SWIG_4(swigCPtr, this, CZone.getCPtr(zone), zone);
  }

  public void retrieve(CZoneInfo zoneInfo) {
    nel3dJNI.CZone_retrieve__SWIG_0(swigCPtr, this, CZoneInfo.getCPtr(zoneInfo), zoneInfo);
  }

  public void retrieve(SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t patchs, SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t borderVertices) {
    nel3dJNI.CZone_retrieve__SWIG_1(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CPatchInfo_t.getCPtr(patchs), SWIGTYPE_p_std__vectorT_NL3D__CBorderVertex_t.getCPtr(borderVertices));
  }

  public void debugBinds(SWIGTYPE_p_FILE f) {
    nel3dJNI.CZone_debugBinds__SWIG_0(swigCPtr, this, SWIGTYPE_p_FILE.getCPtr(f));
  }

  public void debugBinds() {
    nel3dJNI.CZone_debugBinds__SWIG_1(swigCPtr, this);
  }

  public void compile(CLandscape landscape, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CZone_p_t loadedZones) {
    nel3dJNI.CZone_compile(swigCPtr, this, CLandscape.getCPtr(landscape), landscape, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CZone_p_t.getCPtr(loadedZones));
  }

  public void release(SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CZone_p_t loadedZones) {
    nel3dJNI.CZone_release(swigCPtr, this, SWIGTYPE_p_std__mapT_unsigned_int_NL3D__CZone_p_t.getCPtr(loadedZones));
  }

  public void serial(IStream f) {
    nel3dJNI.CZone_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void changePatchTextureAndColor(int numPatch, SWIGTYPE_p_std__vectorT_NL3D__CTileElement_t tiles, SWIGTYPE_p_std__vectorT_NL3D__CTileColor_t colors) {
    nel3dJNI.CZone_changePatchTextureAndColor(swigCPtr, this, numPatch, SWIGTYPE_p_std__vectorT_NL3D__CTileElement_t.getCPtr(tiles), SWIGTYPE_p_std__vectorT_NL3D__CTileColor_t.getCPtr(colors));
  }

  public void refreshTesselationGeometry(int numPatch) {
    nel3dJNI.CZone_refreshTesselationGeometry(swigCPtr, this, numPatch);
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CTileElement_t getPatchTexture(int numPatch) {
    return new SWIGTYPE_p_std__vectorT_NL3D__CTileElement_t(nel3dJNI.CZone_getPatchTexture(swigCPtr, this, numPatch), false);
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CTileColor_t getPatchColor(int numPatch) {
    return new SWIGTYPE_p_std__vectorT_NL3D__CTileColor_t(nel3dJNI.CZone_getPatchColor(swigCPtr, this, numPatch), false);
  }

  public void setTileColor(boolean monochrome, float factor) {
    nel3dJNI.CZone_setTileColor(swigCPtr, this, monochrome, factor);
  }

  public CLandscape getLandscape() {
    long cPtr = nel3dJNI.CZone_getLandscape(swigCPtr, this);
    return (cPtr == 0) ? null : new CLandscape(cPtr, false);
  }

  public void clip(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid) {
    nel3dJNI.CZone_clip(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid));
  }

  public void preRender() {
    nel3dJNI.CZone_preRender(swigCPtr, this);
  }

  public void resetRenderFarAndDeleteVBFV() {
    nel3dJNI.CZone_resetRenderFarAndDeleteVBFV(swigCPtr, this);
  }

  public void forceMergeAtTileLevel() {
    nel3dJNI.CZone_forceMergeAtTileLevel(swigCPtr, this);
  }

  public void refineAll() {
    nel3dJNI.CZone_refineAll(swigCPtr, this);
  }

  public void excludePatchFromRefineAll(long patch, boolean exclude) {
    nel3dJNI.CZone_excludePatchFromRefineAll(swigCPtr, this, patch, exclude);
  }

  public void averageTesselationVertices() {
    nel3dJNI.CZone_averageTesselationVertices(swigCPtr, this);
  }

  public CVector getPatchBias() {
    return new CVector(nel3dJNI.CZone_getPatchBias(swigCPtr, this), false);
  }

  public float getPatchScale() {
    return nel3dJNI.CZone_getPatchScale(swigCPtr, this);
  }

  public boolean compiled() {
    return nel3dJNI.CZone_compiled(swigCPtr, this);
  }

  public long getZoneId() {
    return nel3dJNI.CZone_getZoneId(swigCPtr, this);
  }

  public int getNumPatchs() {
    return nel3dJNI.CZone_getNumPatchs(swigCPtr, this);
  }

  public SWIGTYPE_p_NLMISC__CAABBoxExt getZoneBB() {
    return new SWIGTYPE_p_NLMISC__CAABBoxExt(nel3dJNI.CZone_getZoneBB(swigCPtr, this), false);
  }

  public CPatch getPatch(int patch) {
    long cPtr = nel3dJNI.CZone_getPatch(swigCPtr, this, patch);
    return (cPtr == 0) ? null : new CPatch(cPtr, false);
  }

  public SWIGTYPE_p_NL3D__CZone__CPatchConnect getPatchConnect(int patch) {
    long cPtr = nel3dJNI.CZone_getPatchConnect(swigCPtr, this, patch);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NL3D__CZone__CPatchConnect(cPtr, false);
  }

  public void applyHeightField(CLandscape landScape) {
    nel3dJNI.CZone_applyHeightField(swigCPtr, this, CLandscape.getCPtr(landScape), landScape);
  }

  public void setupColorsFromTileFlags(CRGBA colors) {
    nel3dJNI.CZone_setupColorsFromTileFlags(swigCPtr, this, CRGBA.getCPtr(colors), colors);
  }

  public void copyTilesFlags(int destPatchId, CPatch srcPatch) {
    nel3dJNI.CZone_copyTilesFlags(swigCPtr, this, destPatchId, CPatch.getCPtr(srcPatch), srcPatch);
  }

  public SWIGTYPE_p_CBSphere getPatchBSphere(long patch) {
    return new SWIGTYPE_p_CBSphere(nel3dJNI.CZone_getPatchBSphere(swigCPtr, this, patch), false);
  }

  public boolean isPatchRenderClipped(long patch) {
    return nel3dJNI.CZone_isPatchRenderClipped(swigCPtr, this, patch);
  }

}
